package com.dq.repository.shoppingcart;

import com.dq.domain.goods.Product;
import com.dq.domain.goods.ShoppingBag;
import com.dq.domain.goods.ShoppingCart;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author liuhui
 * @version 1.0
 * @date 2019/9/23 0023 下午 21:43
 */
@Repository
public interface ShoppingBagRepository extends JpaRepository<ShoppingBag, Long> {

    ShoppingBag findByProductAndCart(Product product, ShoppingCart shoppingCart);

    List<ShoppingBag> findByCart(ShoppingCart shoppingCart);

    List<ShoppingBag> findByCartAndIdInAndNumberGreaterThanOrderByCreateTimeDesc(ShoppingCart shoppingCart, List<Long> bagIds,
                                                                       Long goodsNum);

    List<ShoppingBag> findByCartAndNumberGreaterThanAndGoodsDeletedFalseOrderByCreateTimeDesc(ShoppingCart cart, Long n);

}
